<?php

use yii\db\Migration;
use yii\db\Schema;

class m170609_100948_CREATE_TABLE_LEADER extends Migration
{
    public function up()
    {

        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';

		$this->createTable('leader', [
				"id" =>           Schema::TYPE_PK,
				"first_name" =>   Schema::TYPE_STRING.    "(32) NULL COMMENT '姓'",
				"last_name" =>    Schema::TYPE_STRING.    "(32) NULL COMMENT '名'",
				"en_first_name"=> Schema::TYPE_STRING.    "(32) NULL COMMENT '英文姓'",
				"en_last_name"=>  Schema::TYPE_STRING.    "(32) NULL COMMENT '英文名'",
				"code"=>  		  Schema::TYPE_STRING.    "(64) NULL COMMENT '领队证号'",
				"pinyin"=>        Schema::TYPE_STRING.    "(255) NULL COMMENT '名字拼音'",
				"gender" =>       Schema::TYPE_INTEGER.   "(1) DEFAULT  '0' COMMENT '1 男 2 女'",
				"birthday" =>     Schema::TYPE_DATE.      " NULL COMMENT '出生日期'",
				"country"=>       Schema::TYPE_STRING.    "(64) NULL COMMENT '国籍'",
				"passport"=>      Schema::TYPE_STRING.    "(255) NULL COMMENT '护照号码'",
				"passport_add"=>  Schema::TYPE_STRING.    "(255) NULL COMMENT '护照签发地'",
				"passport_date"=> Schema::TYPE_DATE.      " NULL COMMENT '护照有效期'",
				"passport_type"=> Schema::TYPE_INTEGER.   "(1) DEFAULT  '0' COMMENT '护照类型 1 原件 2 复印件'",
				"phone"=>         Schema::TYPE_STRING.    "(64) NULL COMMENT '手机号'",
				"remark"=>        Schema::TYPE_STRING.    "(255) NULL COMMENT '备注说明'",
				"status" =>       Schema::TYPE_INTEGER.   "(1) DEFAULT  '1' COMMENT '1正常  2禁用'",
				"user_id" =>      Schema::TYPE_INTEGER.   "(10) DEFAULT '0' COMMENT '管理员编号'",
				"created_at" =>   Schema::TYPE_DATETIME.  " NULL",
				"updated_at" =>   Schema::TYPE_TIMESTAMP. " NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
			], $tableOptions);


    }

    public function down()
    {
        echo "m170609_100948_CREATE_TABLE_LEADER cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
